﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EffectDestroySelf : MonoBehaviour {

	void Start () {
        ParticleSystem[] effects = GetComponentsInChildren<ParticleSystem>();
        float maxDuration = 0;
        for (int i=0; i<effects.Length; i++)
        {
            if (effects[i].main.duration > maxDuration)
            {
                maxDuration = effects[i].main.duration;
            }
        }
        Destroy(gameObject, maxDuration);
	}

}
